package top.hepingan.cloudorder.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.hepingan.cloudcommon.entity.Order;
import top.hepingan.cloudcommon.msg.Result;
import top.hepingan.cloudorder.feign.AuthServiceFeign;
import top.hepingan.cloudorder.service.OrderService;

@RestController
@RequestMapping("/order")
@RequiredArgsConstructor
public class OrderController {

    private final OrderService orderService;

    @PostMapping(value = "/create",name = "创建订单")
    public Result createOrder(@RequestBody Order order) {
        try {
            orderService.createOrder(order);
            return Result.ok();
        }catch (Exception e){
            return Result.error(e.getMessage());
        }

    }
}
